import '../utils/http/http_client.dart';
import '../models/user_model.dart';

class SystemProvider {
  final HttpClient _httpClient = HttpClient();
  
  // 获取当前用户信息
  Future<UserInfoResponse> getUserInfo() async {
    try {
      final response = await _httpClient.get('/system/user/getInfo');
      return UserInfoResponse.fromJson(response);
    } catch (e) {
      rethrow;
    }
  }
  
  // 获取国标设备信息
  Future<Map<String, dynamic>> getGBDeviceInfo(String deviceId) async {
    try {
      final response = await _httpClient.get(
        '/system/GB28181device/list',
        params: {'device_id': deviceId},
      );
      
      return response;
    } catch (e) {
      rethrow;
    }
  }
  
  // 获取国标设备下的通道列表
  Future<Map<String, dynamic>> getGBChannelList(String dataDeviceId) async {
    try {
      final response = await _httpClient.get(
        '/system/GB28181channel/list',
        params: {'data_device_id': dataDeviceId},
      );
      
      return response;
    } catch (e) {
      rethrow;
    }
  }
} 